#ifndef MAINWINDOWIMPL_H
#define MAINWINDOWIMPL_H
//
#include <QMainWindow>
#include <QDebug>
#include <QString>
#include "ui_mainwindow.h"
#include "plot.h"
#include "signaldata.h"
#include "config.h"
#include "httpengine.h"

//
class MainWindowImpl : public QMainWindow, public Ui::MainWindow
{
Q_OBJECT
public:
	MainWindowImpl( QWidget * parent = 0, Qt::WFlags f = 0 );
        ~MainWindowImpl();
	
private:
        Plot* plot;
        HttpEngine* http;
	QString dataReceived;
        Config configHandler;

        void parseLineReceived(QString dataToParse);

signals:
        void temperatureReceived(double value);
        void configurationReceived(double tSetReceived, double tRangeReceived);
        void aireStateReceived(int state);
        void textToLog(QString txt);
        void getConfiguration();
        void setConfiguration();

private slots:
        void receivedSerial(QByteArray Dato); //recepcion de dato x puerto serie
        void connectionStateSet(bool state); //cambia estado de label de conexion
        void readConfiguration(); //lee configuracion seteada del dispositivo
        void writeConfiguration();  //escribe configuracion al dispositivo
        void refreshLCDTemperature(double value); //refresca temperatura del LCD
        void addTemperatureToPlot(double value); // agrega temperatura al grafico
        void logAppend(QString txt); // logear txt
        void aireStateChange(int state); //cambio en el estado del aire
        void configurationTemperatureReceived(double tSetReceived, double tRangeReceived); //recibe configuracion de dispositivo
        void updateWeb();

public slots:
    void btPuertoAbrir_pulsado(void);
    void btPuertoCerrar_pulsado(void);
    void btPuertoEnviarTexto_pulsado(void);
    void timer_Tick(void);

protected:
    void changeEvent(QEvent *e);

private:
    QTimer *timer;
};
#endif




